package com.main.ok.push;

import java.util.Set;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.greenline.push.services.PushCenterCommonService;
import com.greenline.push.services.dto.ResponseCode;
import com.greenline.push.services.dto.ResponseDTO;

public class SearchDomainCode {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        PushCenterCommonService pushService = (PushCenterCommonService) ctx.getBean("pushService");
        ResponseDTO<Set<String>> sResult = pushService.getDomainCodeByTemplateAndAppId("orderSuccessTemplate", "wx72274b2566831958");
        if (sResult.getCode().equalsIgnoreCase(ResponseCode.SUCCESS)) {
            System.out.println(sResult.getMessage());
            Set<String> domainResultset = sResult.getDataResult();
            for (String domain : domainResultset) {
                // 比如"掌上医院" 的域开头是 zsyy
                if (domain.startsWith("zsyy"))
                    System.out.println("我要找的域code是:" + domain);
                else
                    System.out.println(domain);
            }
        } else {
            System.out.println(sResult.getDataResult() + ">>>" + sResult.getCode() + "--" + sResult.getErrorMsg());
        }
    }
}
